ceTe Software Help Library for Java August - 2020
DynamicPDF Generator for Java / Programming with Generator for Java / Advanced Topics / Package PDF(Portfolio)
In This Topic
    Package PDF(Portfolio)
    In This Topic

    A PDF Package contains multiple files that together form a single unit. The files that can be embedded within the PDF Package can be a wide range of file types from different applications (including PDFs, images, spreadsheets, text files, etc.). Along with the embedded files, the PDF Package contains a PDF (that acts as a cover sheet for the package). The style and order that the embedded files will appear can be specified within the DocumentPackage Class.

    The following example demonstrates how to create a DocumentPackage, display the embedded files in detail mode sorted in descending order by name.

    [Java]
    Document document = new Document();
    EmbeddedFile embeddedFile1 = new EmbeddedFile("C:\\DocumentA.pdf");
    EmbeddedFile embeddedFile2 = new EmbeddedFile("C:\\DocumentB.pdf");
    document.getEmbeddedFiles().add( embeddedFile1 );
    document.getEmbeddedFiles().add( embeddedFile2 );
    Page page = new Page();
    document.getPages().add( page );
    document.setPackage(new DocumentPackage(AttachmentLayout.DETAILED));
    document.getPackage().setOrderBy(AttachmentListingOrderBy.NAME);
    document.getPackage().setAscendingOrder(false);
    page.getElements().add( new Label("Cover Page", 0, 0, 512, 40, Font.getHelvetica(), 30, TextAlign.CENTER ) );
    document.draw( "C:\\MyDocumentPackage.pdf" );